package com.sc.nft.dao;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.dto.AssessLogAdminDetailsPageDTO;
import com.sc.nft.entity.dto.AssessLogAdminDetailsPageVO;
import com.sc.nft.mapper.WorkCityServerAssessDetailLogMapper;
import com.sc.nft.entity.WorkCityServerAssessDetailLog;
import com.sc.nft.service.WorkCityServerAssessDetailLogService;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

/**
 * 考核记录详情表(WorkCityServerAssessDetailLog)表Dao层
 *
 * @author 王伟成
 * @since 2024-04-09 20:11:05
 */
@Slf4j
@Repository
public class WorkCityServerAssessDetailLogDao extends ServiceImpl<WorkCityServerAssessDetailLogMapper, WorkCityServerAssessDetailLog> {

    public Page<AssessLogAdminDetailsPageVO> assessDetailsPage(AssessLogAdminDetailsPageDTO assessLogAdminDetailsPageDTO) {
        if(ObjectUtil.isNotNull(assessLogAdminDetailsPageDTO.getType())){
            return baseMapper.assessDetailsPage(assessLogAdminDetailsPageDTO.toMp(),assessLogAdminDetailsPageDTO.getUserTel(),assessLogAdminDetailsPageDTO.getType().getCode(),assessLogAdminDetailsPageDTO.getId());
        }
        return baseMapper.assessDetailsPage(assessLogAdminDetailsPageDTO.toMp(),assessLogAdminDetailsPageDTO.getUserTel(),null,assessLogAdminDetailsPageDTO.getId());
    }

    public String assessDetailsResult(Long id) {
        return baseMapper.assessDetailsResult(id);
    }
}
